package 多线程.AQS;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Main {
    public static void main(String[] args) {
        Lock lock = new ReentrantLock();
        Thread a = new Thread(()->{
            try {
                lock.lock();
                System.out.println("a");
            }finally {
                lock.unlock();
            }
        },"a");
        a.start();
        Thread b = new Thread(()->{
            try {
                lock.lock();
                System.out.println("b");
            }finally {
                lock.unlock();
            }
        },"b");
        b.start();

    }
}
